/**
 * @Author: YCKOKO
 * @Date: 2023-04-03
 * @Time:08:35
 * @Description:
 */
public class demo2 {
    public static void main(String[] args) {
        String A = "1807";
        String B = "7810";
        String ret = getHint(A,B);
        System.out.println(ret);
    }
    public static String getHint(String secret, String guess) {
        int[] nums1 = new int[10];
        int[] nums2 = new int[10];
        int bulls = 0;
        for(int i = 0; i < secret.length(); i++){
            if(secret.charAt(i) == guess.charAt(i)){
                bulls++;
            }
            nums1[secret.charAt(i)-'0']++;
            nums2[guess.charAt(i)-'0']++;
        }
        int cows = 0;
        for(int i = 0; i < nums1.length; i++){
            cows += Math.min(nums1[i],nums2[i]);
        }
        cows = cows - bulls;
        String ret = bulls + "A" + cows + "B";
        return ret;

    }
}
